<template>
  <div ref="wrap" class="rader-wrap"></div>
</template>

<script>
// 引入 echarts 核心模块，核心模块提供了 echarts 使用必须要的接口。
import * as echarts from "echarts/core";
// 引入六边形，图表后缀都为 Chart
import { RadarChart } from "echarts/charts";
// 引入提示框，标题，直角坐标系组件，组件后缀都为 Component
import { TitleComponent, TooltipComponent } from "echarts/components";
// 引入 Canvas 渲染器，注意引入 CanvasRenderer 或者 SVGRenderer 是必须的一步
import { CanvasRenderer } from "echarts/renderers";

// 注册必须的组件
echarts.use([TitleComponent, TooltipComponent, RadarChart, CanvasRenderer]);
export default {
  mounted() {
    var myChart = echarts.init(this.$refs.wrap);

    var option = {
      title: {
        text: "基础雷达图",
      },

      radar: {
        // shape: 'circle',
        indicator: [
          { name: "销售", max: 6500 },
          { name: "管理", max: 16000 },
          { name: "信息技术", max: 30000 },
          { name: "客服", max: 38000 },
          { name: "研发", max: 52000 },
          { name: "市场", max: 25000 },
        ],
      },
      series: [
        {
          name: "预算 vs 开销（Budget vs spending）",
          type: "radar",
          data: [
            {
              value: [4200, 3000, 20000, 35000, 50000, 18000],
              name: "预算分配（Allocated Budget）",
            },
            {
              value: [5000, 14000, 28000, 26000, 42000, 21000],
              name: "实际开销（Actual Spending）",
            },
          ],
        },
      ],
    };

    myChart.setOption(option);
  },
};
</script>

<style>
.rader-wrap {
  width: 400px;
  height: 400px;
  margin: 0 auto;
}
</style>